webpackJsonp([29],{

/***/ "A728":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "gy3f":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/router/index.js + 16 modules
var router = __webpack_require__("YaEn");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./node_modules/_lodash@4.17.11@lodash/lodash.js
var lodash = __webpack_require__("psq8");
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);

// EXTERNAL MODULE: ./src/common/plugin/utils/index.js + 26 modules
var utils = __webpack_require__("5/dX");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/repository/weixinOpenFile.vue
//
//
//
//
//



var getFileType = function getFileType(url) {
  var resault = url.substring(url.lastIndexOf('.') + 1);
  return resault;
};

/* harmony default export */ var weixinOpenFile = ({
  name: 'yt-openFile',
  props: {
    /**
     * 文件的路径
     */
    url: String,
    /**
     * 文件的名称
     */
    title: String,
    /**
     * 文件不存在时提示文字
     */
    errorText: {
      type: String,
      default: '暂无附件!'
    }
  },
  methods: {
    handlerClick: function handlerClick() {
      if (Object(utils["p" /* isImg */])(this.url) || Object(utils["q" /* isVideo */])(this.url)) {
        this.$router.$push({
          path: '/base/play',
          query: { name: this.title, url: this.url }
        });
      } else if (getFileType(this.url) === 'txt') {
        this.$router.$push({
          path: '/base/previewTxt',
          query: { name: this.title, url: this.url }
        });
      } else {
        window.open(this.url);
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-69316a34","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/repository/weixinOpenFile.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"yt-open-file use-weixin",on:{"click":_vm.handlerClick}},[_vm._t("default")],2)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var repository_weixinOpenFile = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/repository/weixinOpenFile.vue
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  weixinOpenFile,
  repository_weixinOpenFile,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_repository_weixinOpenFile = (Component.exports);

// EXTERNAL MODULE: ./static/js/mmbs.js
var mmbs = __webpack_require__("67dv");
var mmbs_default = /*#__PURE__*/__webpack_require__.n(mmbs);

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/repository/index.vue


//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//







/* harmony default export */ var repository = ({
  data: function data() {
    var _this = this;

    return {
      isWeixin: false,
      title: '',
      showSearch: false,
      rightData: [{
        font: 'yt-icon yt-icon-search',
        click: function click() {
          _this.showSearch = !_this.showSearch;
        }
      }],
      tabsDic: [],
      selected: '',
      canRenderGroup: false,
      searchApi: function () {
        var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee(_ref2) {
          var skip = _ref2.skip,
              limit = _ref2.limit;

          var currentTab, param, items, _items, itemsAfter;

          return regenerator_default.a.wrap(function _callee$(_context) {
            while (1) {
              switch (_context.prev = _context.next) {
                case 0:
                  _context.next = 2;
                  return _this.fetchTabsDic();

                case 2:
                  _this.tabsDic = _context.sent;
                  currentTab = _this.tabsDic.find(function (val) {
                    return val.D_code === _this.selected;
                  });

                  _this.title = currentTab ? currentTab.D_text : '知识库';

                  if (!(_this.selected !== 'yj_case')) {
                    _context.next = 15;
                    break;
                  }

                  param = {};

                  if (!_this.selected) {
                    param = { skip: skip, limit: limit };
                  } else {
                    param = {
                      skip: skip,
                      limit: limit,
                      equalTo: { fileCategory: _this.selected }
                    };
                  }
                  _context.next = 10;
                  return commonApi["a" /* commonApi */].search('GO_dangerous_chemicals', param);

                case 10:
                  items = _context.sent;


                  items = lodash_default.a.map(items, function (v) {
                    return {
                      name: v.fileList ? v.fileList[0].name : '',
                      url: v.fileList ? v.fileList[0].url : ''
                    };
                  });
                  return _context.abrupt('return', items);

                case 15:
                  _context.next = 17;
                  return commonApi["a" /* commonApi */].search('yj_case');

                case 17:
                  _items = _context.sent;
                  itemsAfter = [];

                  lodash_default.a.forEach(_items, function (item) {
                    lodash_default.a.forEach(item.file, function (file) {
                      itemsAfter = lodash_default.a.concat(itemsAfter, [file]);
                    });
                  });
                  return _context.abrupt('return', itemsAfter);

                case 21:
                case 'end':
                  return _context.stop();
              }
            }
          }, _callee, _this);
        }));

        return function searchApi(_x) {
          return _ref.apply(this, arguments);
        };
      }()
    };
  },

  components: { WeixinOpenFile: anjian_repository_weixinOpenFile },
  methods: {
    fetchTabsDic: function fetchTabsDic() {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        var tabsDic;
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.prev = 0;

                if (_this2.tabsDic.length) {
                  _context2.next = 9;
                  break;
                }

                _context2.next = 4;
                return commonApi["a" /* commonApi */].dictionary('enterprise_safety');

              case 4:
                tabsDic = _context2.sent;

                tabsDic.push({ D_code: 'yj_case', D_text: '应急案例库' }); // 应急案例库是额外加上去的，不在同一张表里
                return _context2.abrupt('return', tabsDic);

              case 9:
                return _context2.abrupt('return', _this2.tabsDic);

              case 10:
                _context2.next = 14;
                break;

              case 12:
                _context2.prev = 12;
                _context2.t0 = _context2['catch'](0);

              case 14:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2, [[0, 12]]);
      }))();
    },
    onSearch: function onSearch(selected) {
      this.$refs.group.startPull();
      this.showSearch = false;
    },
    onReset: function onReset() {
      this.selected = '';
      this.$refs.group.startPull();
      this.showSearch = false;
    }
  },
  created: function created() {
    mmbs_default.a.useAllowAnonymousKey = true; // 因微信公众号内访问，开放接口访问权限
  },
  activated: function activated() {
    // 如果是微信内打开，对查看文件组件进行特殊处理
    if (this.$route.query && this.$route.query.client === 'weixin') {
      this.isWeixin = true;
    }

    if (this.$route.query && this.$route.query.type) {
      this.selected = this.$route.query.type;
    } else {
      this.selected = '';
    }
    this.$refs.group.startPull();
  },
  destroyed: function destroyed() {
    mmbs_default.a.useAllowAnonymousKey = false; // 离开页面，关闭接口访问权限
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-8a7ab010","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/repository/index.vue
var repository_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":_vm.title,"rightData":_vm.rightData}},[_c('yt-group',{ref:"group",attrs:{"autoRefresh":false,"group":false,"searchApi":_vm.searchApi},scopedSlots:_vm._u([{key:"default",fn:function(item){return _c('div',{},[(_vm.isWeixin)?_c('weixin-open-file',{attrs:{"title":item.name,"url":item.url}},[_vm._v(_vm._s(item.name))]):_vm._e(),_vm._v(" "),(!_vm.isWeixin)?_c('yt-cell-open-file',{attrs:{"title":item.name,"url":item.url}},[_vm._v("\n        "+_vm._s(item.name)+"\n      ")]):_vm._e()],1)}}])}),_vm._v(" "),_c('yt-popup',{attrs:{"slot":"alert","pos":"right","mask":true},slot:"alert",model:{value:(_vm.showSearch),callback:function ($$v) {_vm.showSearch=$$v},expression:"showSearch"}},[_c('yt-page',{staticClass:"page",attrs:{"flex":true,"leftData":[],"title":"按类别查询"}},[_c('yt-form',[_c('yt-inlineSelect',{attrs:{"list":_vm.tabsDic,"x":2,"label":"D_text","val":"D_code"},model:{value:(_vm.selected),callback:function ($$v) {_vm.selected=$$v},expression:"selected"}}),_vm._v(" "),_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false,"edge":""},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white"},on:{"click":function($event){return _vm.onReset()}}},[_vm._v("重置")]),_vm._v(" "),_c('yt-btn',{on:{"click":function($event){return _vm.onSearch(_vm.selected)}}},[_vm._v("查询")])],1)],1)],1)],1)],1)}
var repository_staticRenderFns = []
var repository_esExports = { render: repository_render, staticRenderFns: repository_staticRenderFns }
/* harmony default export */ var anjian_repository = (repository_esExports);
// CONCATENATED MODULE: ./src/common/anjian/repository/index.vue
function injectStyle (ssrContext) {
  __webpack_require__("A728")
}
var repository_normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var repository___vue_template_functional__ = false
/* styles */
var repository___vue_styles__ = injectStyle
/* scopeId */
var repository___vue_scopeId__ = "data-v-8a7ab010"
/* moduleIdentifier (server only) */
var repository___vue_module_identifier__ = null
var repository_Component = repository_normalizeComponent(
  repository,
  anjian_repository,
  repository___vue_template_functional__,
  repository___vue_styles__,
  repository___vue_scopeId__,
  repository___vue_module_identifier__
)

/* harmony default export */ var common_anjian_repository = __webpack_exports__["default"] = (repository_Component.exports);


/***/ })

});